################################
#
#     Makefile PRIMO ASSEGNAMENTO AA 2019/20
#    
################################


# file da consegnare
# modificare se si aggiungono file
FILE_DA_CONSEGNARE=bubble.c

# preferenze compilatore e flag di compilazione
CC=gcc
# compilazione 
CFLAGS= -Wall -pedantic -g

obj = bubble.o bubble_docenti.o



# phony targets
.PHONY: cleanall test1 test2 test3 consegna 


bubble0 : 00test.o $(obj)
	gcc $(obj) 00test.o -o bubble0 -lm

bubble1 : 01test.o $(obj)
	gcc $(obj) 01test.o -o bubble1 -lm

bubble2 : 02test.o $(obj)
	gcc $(obj) 02test.o -o bubble2 -lm

bubble3 : 03test.o $(obj)
	gcc $(obj) 03test.o -o bubble3 -lm

bubble4 : 04test.o $(obj)
	gcc $(obj) 04test.o -o bubble4 -lm


bubble.o: bubble.c bubble.h  
01test.o: 01test.c bubble.h   
02test.o: 02test.c bubble.h   
03test.o: 03test.c bubble.h   
04test.o: 04test.c bubble.h   

bubble: $(obj) main.o
	gcc $(obj) main.o -o bubble -lm


cleanall: 
	-rm -f *.o *~ ./core bubble? bubble



test1:
	make cleanall
	make bubble1
	./bubble1 
	@echo "********** Test1 superato!"

test2: 
	make cleanall
	make bubble2
	./bubble2
	@echo "********** Test2 superato!"

test3:
	make cleanall
	make bubble3
	./bubble3
	@echo "********** Test3 superato!"

test4: 
	make cleanall
	make bubble4
	./bubble4
	@echo "********** Test4 superato!"

consegna:
	make cleanall
	make test1
	make test2
	make test3
	./gruppo-check.pl < gruppo.txt
	tar -cvf $(USER)-a1.tar ./gruppo.txt  $(FILE_DA_CONSEGNARE) 
	@echo "********** TAR creato inviare in allegato a una mail al docente del proprio corso insieme a nome, cognome,  numero di matricola dei componenti del gruppo"
